<template>
    <div class="professor_jlpg">
       <!-- <router-view/>-->
        <div class="layout">

            <div class="table">
              
                <div>
                    <div><h3>简历评估</h3></div>
                     <div>

    <!-- 卡片视图区域 -->
    <el-card style="margin-top: 20px">
        <el-row :gutter="20">
          <!-- 搜索框 -->
<!--         <el-col :span="8">
            <el-input
              placeholder="请输入账号进行搜索"
              v-model="input"
              clearable
              size="medium"
            >
              <el-button
                type="primary"
                slot="append"
                icon="el-icon-search"
                @click="search()"
              ></el-button>
            </el-input>
          </el-col> -->
        </el-row>

        <!-- 用户列表区域 -->
        <el-table :data="tableData" stripe style="width: 100%" border >
		  <el-table-column v-for="column in columns" :key="column.field"
		  :label="column.title" :prop="column.field" width="100"
		  ></el-table-column>
		  		 
		 <el-table-column fixed="right" label="操作">
            <template slot-scope="scope">
              <!-- 侧框按钮 -->
              <el-button @click="pingjia(scope.row)" type="primary" style="margin-left: 16px;">
                评价
              </el-button>
			  <!-- <el-button @click="del(scope.row)" type="primary" style="margin-left: 16px;">
			    删除
			  </el-button> -->
          
            </template>
          </el-table-column>
        </el-table>
		
     <!-- 侧框 -->
     <el-drawer
  :visible.sync="drawer"
  size="50%">
  <div>
   <span >
        <el-form label-width="80px" label-left="0px">
			评价
          </el-form>         
     </span>
	   评级等级	：<el-select v-model="work.commentLevel" clearable placeholder="请选择评价等级">
	     <el-option
	       v-for="item in options"
	       :key="item.value"
	       :label="item.label"
	       :value="item.value">
	     </el-option>
	   </el-select>
	   <el-input
	     type="textarea"
	     :rows="4"
	     placeholder="请输入评价内容"
	     v-model="work.content">
	   </el-input>
	   <el-button type="primary" @click="exit()" plain>提交</el-button>
	   <el-button round @click="clean()">取消</el-button>
	
  </div>
</el-drawer>
      <!-- 分页 -->
      <div class="block">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage4"
          :page-sizes="[6, 10, 15]"
          :page-size="100"
          layout="total, sizes, prev, pager, next, jumper"
          :total="6"
        >
        </el-pagination>
      </div>
    </el-card>
  </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
<script>
	import axios from 'axios';
export default {
  data() {
    return {
      //侧框
      drawer: false,
        innerDrawer: false,
      searchs: [],
      input: null,
      // 查找列表
     columns:[
		 {title:"评价状态",field:"status"},
		 {title:"评价等级",field:"commentLevel"},
		 {title:"账号",field:"resumeKey"},
		 {title:"姓名",field:"realName"},
		 {title:"学历",field:"education"},
		 {title:"专业",field:"speciality"},
		 {title:"毕业学校",field:"graduation"},
		 {title:"工作年限",field:"workTime"},
		 {title:"目标城市",field:"exceptedWorkplace"},
		 {title:"评价意见",field:"content"},
		 ],
      // 显示列表
      tableData: [
		{screenKey:'',userKey:'',status: '待评价',commentLevel:"",resumeKey: ' 123456 ',realName: ' 张三 ',education: ' 本科 ',speciality: ' 软件 ',graduation: ' 加里顿大学 ',workTime: ' 3年 ',exceptedWorkplace: ' 上海 ',content: ' 无 ', isdelete:""},
		{screenKey:'',userKey:'',status: '已评价',commentLevel:"一般",resumeKey: ' 123456 ',realName: ' 李四 ',education: ' 本科 ',speciality: ' 软件 ',graduation: ' 加里顿大学 ',workTime: ' 3年 ',exceptedWorkplace: ' 上海 ',content: ' 无 ', isdelete:""}],
      el_show: false,
      el_xiu: false,
      formLabelWidth: '120px',
      newid: 0,
	  userKey:"103",
	  work:{
		  screenKey:"",
		  resumeKey:"",
		  userKey:"",
		  status:"",
		  commentLevel:-1,
		  content:"",
		  isdelete:""
	  },

      // 分页
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4,
	  //评价等级
	  options: [{
	            value: 0,
	            label: '需要重新修改'
	          },{
	            value: 1,
	            label: '一般'
	          }, {
	            value: 2,
	            label: '良好'
	          }, {
	            value: 3,
	            label: '优秀'
	          }],
	          value: '',
			  hello:"2"
    }
  },
  mounted(){
	this.list();  
  },
  methods: {
	  // del(v){
		  
	  // },
	  pingjia(v){
		  this.drawer = true	
		  axios.get("http://localhost:9001/screen-resume/getById",
		  {
			params:{screenKey:v.screenKey}  
		  }).then((response)=>{			  
			  this.work=response.data
		  })	
	  },
	  clean(){
		  this.drawer = false
		  this.value=""
		  this.textarea=""
	  },
	  exit(){		  
		  this.work.commentLevel=this.value		  
		  this.work.content=this.textarea
		  axios.post("http://localhost:9001/screen-resume/edit",
		  {
			  status:1,
			  commentLevel:this.work.commentLevel,
			  resumeKey:this.work.resumeKey,
			  content:this.work.content,
			  screenKey:this.work.screenKey,			  
			  userKey:this.work.userKey,			  			  			  
			  isdelete:this.work.isdelete
		  }).then((response)=>{
			  this.list()
			  this.drawer = false
		  })
	  },
	  list(){
		  axios.get("http://localhost:9001/screen-resume/list",
		  {
			  params:{
				  user_key:this.userKey
			  },
			  }).then((response)=>{		
				  for (var i = 0; i < response.data.length; i++) {
				  	if(response.data[i].status=="1")
						response.data[i].status="已评价"
					else{
						response.data[i].status="未评价"
					}
					if(response.data[i].education=="0"){
						response.data[i].education="大专"
					}else if(response.data[i].education=="1"){
						response.data[i].education="本科"
					}else if(response.data[i].education=="2"){
						response.data[i].education="硕士"
					}else{
						response.data[i].education=""
					}
					if(response.data[i].commentLevel=="0"){
						response.data[i].commentLevel="需要重新修改"
					}else if(response.data[i].commentLevel=="1"){
						response.data[i].commentLevel="一般"
					}else if(response.data[i].commentLevel=="2"){
						response.data[i].commentLevel="良好"
					}else if(response.data[i].commentLevel=="3"){					
						response.data[i].commentLevel="优秀"
					}else{
						response.data[i].commentLevel=""
					}
					
				  }
				  this.tableData=response.data;
			  });
		},
    // 分页
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
    },
    // 查找
    search: function () {
      console.log(this.input)
      this.tableData.map((item) => {
        if (this.input == null || this.input == '') {
          this.list();
          return
        } else if (item.resumeKey.includes(this.input)) {
          this.searchs = []
          this.searchs.push(item)
          console.log(this.searchs)
          this.tableData = this.searchs
          console.log(this.tableData)
          return
        }
      })
    },
  },
}
</script>
<style scoped>
    h2,h3{
        width: 150px;
        margin: 20px auto;
    }
    .professor_jlpg{
        width: 100%;
        height: 100%;
    }
    .layout{
        width: 100%;
        height: 100%;
    }
    .table{
        width: calc(100% - 100px);
        margin: 0 50px;
        padding: 0 10px;
        height: 100%;
        border: 1px solid #000;
        background-color: #EFEFEF;
    }
    .one{
        width: calc(100% - 40px);
        height: 50px;
        display: flex;
        margin: 20px;
        align-items: center;
        background-color: #ffffff;
        border: 1px solid #000;
    }
    .one input{
        margin: 0 20px;
    }
    .two{
        width: 100%;
    }


 .text {
    font-size: 14px;
  }

  .item {
    padding: 18px 0;
  }

  .box-card {
    width: 480px;
  }
  .tree1{
      display: flex;
  }
</style>
